package com.wzapp.sitposture.common.util;

import com.alibaba.fastjson.JSON;
import com.wzapp.sitposture.common.base.DeviceInfo;

import java.net.URLDecoder;

public class DeviceInfoUtil {

    private static final String secretKey = "ff8080816120cbd1016120cd81e22018";// Header秘钥

    public static DeviceInfo decodeDeviceInfo(String signed){
        /*
        signSignature = MD5（signAccesstoken + "=" + accesstoken
        + "&" + signDeviceBrand + "=" + deviceBrand
        + "&" + signDeviceType + "=" + deviceType
        + "&" + signDeviceCode + "=" + deviceCode
        + "&" + signLanguage + "=" + language
        + "&" + os + "=" + os
        + "&" + signOsVersion + "=" + osVersion
        + "&" + signAppVersion + "=" + appVersion
        + "&" + secretKey）;
         */
        if (ToolUtil.isEmpty(signed)) {
            return new DeviceInfo();
        }
        DeviceInfo deviceInfo = JSON.parseObject(URLDecoder.decode(signed), DeviceInfo.class);

       return deviceInfo;
    }

}
